#convert base.html to base.txt, then take the latest file, convert it to new.txt: Compare em and email the diff.txt
while true; do 
	# #convert  the latest file
	# html2text.py `ls -ct1 | head -1`|sed -e 's/\[[0-9]*\]//g'|sed -n '/\[Location\]\ \!\ \[Date\]\ \!/,/Go to page/p'|sed -n '/[a-zA-Z]/p'|tail -n +2| sed 's|,||g'|sed -n '1h;2,$H;${g;s/\n/,/g;p}' |sed -e 's|\],\[|,|g' -e 's|,\[|\n|g'|sort>new.txt
	# html2text.py base.htm|sed -e 's/\[[0-9]*\]//g'|sed -n '/\[Location\]\ \!\ \[Date\]\ \!/,/Go to page/p'|sed -n '/[a-zA-Z]/p'|tail -n +2| sed 's|,||g'|sed -n '1h;2,$H;${g;s/\n/,/g;p}' |sed -e 's|\],\[|,|g' -e 's|,\[|\n|g'|sort>base.txt
	# cat new.txt|while read line;do num=`grep -F -c "$line" base.txt`; s=$( printf "%"$(( num^1 ))"s" ); echo " ${s// /$line}";done>diff.txt
	# #                                -F=fixedString,c=count            print $line masking of <$num> with 1 times
	 # if (( `diff base.txt  new.txt|wc -l` ));then mutt -s "New jobs Macha"  sourabhbora@gmail.com vrprasan@gmail.com<diff.txt ;fi
	 # #/bin/rm *.txt
	 
	 echo "I just woke up, working on new.html"
	#new code that works only when SAVEAS TYPE=TXT is used in imacros
	cat new.html|sed -n '/Job Title\ \tCompany\ \tLocation\ \tDate/,/Go to page/p'|tail -n +2|head -n -1| sed 's|Keyword\ found\ in:\ Job\ description:|##:|g'|sed -e '/\#\#:/! s|\n||g'|sed -e '/\#\#:/! i\#newlineFlag#'|tr -d '\n'|sed -e 's|##:|\t|g'|sed -e 's|#newlineFlag#|\n|g'|sort>new.txt
	echo "working on base.html"
	cat  base.html          |sed -n '/Job Title\ \tCompany\ \tLocation\ \tDate/,/Go to page/p'|tail -n +2|head -n -1| sed 's|Keyword\ found\ in:\ Job\ description:|##:|g'|sed -e '/\#\#:/! s|\n||g'|sed -e '/\#\#:/! i\#newlineFlag#'|tr -d '\n'|sed -e 's|##:|\t|g'|sed -e 's|#newlineFlag#|\n|g'|sort>base.txt
	cat new.txt|while read line;do num=`grep -F -c "$line" base.txt`; s=$( printf "%"$(( num^1 ))"s" ); echo " ${s// /$line}";done>diff.txt
	#                                -F=fixedString,c=count            print $line masking of <$num> with 1 times
	 if (( `diff base.html  new.html|wc -l` ));then echo "Sending email"; mutt -s "New jobs Macha"  sourabhbora@gmail.com vrprasan@gmail.com<diff.txt ;diff base.txt  new.txt; fi
	 echo "moving all text files and then sleeping"
	 mv  *.txt ./textfiles
	 cp new.html base.html
	 sleep 600
done
#mutt -s "New jobs Macha"  sourabhbora@gmail.com vrprasan@gmail.com<diff.txt ;
#note: html2text.py is NOT required if you save the file as TXT in imacros (firefox save as text sucks) 